'use strict';

const { Controller } = require('egg');
const { Op } = require('sequelize');
const serviceName = 'pvForecastRel'
class RouterController extends Controller {
  // 修改
  async update() {
    const { ctx } = this;
    const infos = ctx.request.body;
    if (infos.length === 0) throw new Error('请传递修改的内容');
    await ctx.service[serviceName].update(infos);
    ctx.success(true, 200);
  }
  // 所有列表
  async allList() {
    const { service } = this.ctx;
    const list = await service[serviceName].allList();
    this.ctx.success(list);
  }
}

module.exports = RouterController;
